package com.example.mapper;

import com.example.entity.auth.Account;
import com.example.entity.user.AccountUser;
import org.apache.ibatis.annotations.*;

/**
 * @author AiXu
 * @version v1.0
 * @since 2023/9/11 16:10
 */
@Mapper
public interface UserMapper {

    @Select("select username,password,email from db_account where username = #{text} or email = #{text}")
    Account findAccountByNameOrEmail(String text);
    @Select("select id,username,email from db_account where username = #{text} or email = #{text}")
    AccountUser findAccountUserByNameOrEmail(String text);

    @Insert("insert into db_account(username, password, email) value (#{username},#{password},#{email})")
    int createAccount( String username,  String password, String email);

    @Update("update db_account set password = #{password} where email = #{email}")
    int resetPasswordByEmail(String password, String email);
}
